<?php 
if ($NRO4352=="") {
	$SQL="SELECT max(valor) as valor, substring(YEAR(NOW()),3) as year FROM td_consultasPI WHERE idpreg=4352;";
	$nrocons=$forms2->Execute($SQL) or DIE ("Error: $SQL");
	$valor=$nrocons->Fields("valor");
	if ($valor=="") {
		$valor="0001/07";
	} else {
	 	$nro=$nrocons->Fields("valor");
		$nro=substr($nro,0,4)+1;
		$nro=str_pad($nro,4,"0",STR_PAD_LEFT);
		$valor=$nro."/".$nrocons->Fields("year");
	}
} else {
	$valor=$NRO4352;
}
?>